﻿using System;
using System.Data;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;
using AnyOffice.Model;

namespace AnyOffice.general.netmeeting.manage
{
    public partial class _new : ModulePage
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                this.txtBeginTime.Value = DateTime.Now.ToString();
                this.ckbMobile.Visible = SmsDao.IsMobile(SmsDao.SmsType.NetMeeting);
            }
            if (this.Page.IsPostBack)
            {
                NetMeetingSessionsDao dao = new NetMeetingSessionsDao();
                NetMeetingSessionsData data = new NetMeetingSessionsData();
                data.SessionName = this.txtSessionName.Value;
                data.FromId = base.User.Identity.Name;
                data.ToId = this.ToId.Value;
                data.BeginTime = Convert.ToDateTime(this.txtBeginTime.Value);
                dao.Insert(base.Conn, data);
                if (this.ckbSms.Checked || this.ckbMobile.Checked)
                {
                    SmsData data2 = new SmsData();
                    SmsDao dao2 = new SmsDao();
                    data2.Type = 3;
                    data2.FromId = base.User.Identity.Name;
                    data2.ToIdList = this.ToId.Value;
                    data2.Content = "请出席网络会议！\n议题：" + this.txtSessionName.Value;
                    data2.RemindFlag = true;
                    data2.SendTime = Convert.ToDateTime(this.txtBeginTime.Value);
                    dao2.BizSend(base.Conn, data2, this.ckbSms.Checked, this.ckbMobile.Checked);
                }
                base.CloseConn();
                Response.Redirect("index.aspx");
            }
        }
 

    }
}
